package org.henau.PathCommand;

// 2. 具体路径命令
public class AdjustPathCommand implements PathCommand {
    private PathPlanner planner;
    private Path newPath;
    private Path originalPath;

    public AdjustPathCommand(PathPlanner planner, Path newPath) {
        this.planner = planner;
        this.newPath = newPath;
        this.originalPath = planner.getCurrentPath();
    }

    @Override
    public void execute() {
        System.out.println("🚜 执行路径调整命令");
        planner.setPath(newPath);
    }

    @Override
    public void undo() {
        System.out.println("↩️ 撤销路径调整");
        planner.setPath(originalPath);
    }
}